package chapter07

import scala.collection.mutable

object Test09_MutableMap {
  def main(args: Array[String]): Unit = {
    //1创建map
    val map1 = mutable.Map(("a" -> 13), ("b" -> 25), ("hello" -> 3))
    println(map1)
    println(map1.getClass)
    println("======================================")
    //2.添加元素
    map1.put("c",15)
    println(map1)
    println("======================================")
    map1+=(("e",7))
    println(map1)
    println("======================================")
    //3.删除元素
    map1.remove("c")
    println(map1)
    println("======================================")
    map1-="a"
    println(map1)
    println("======================================")
    //5.合并两个map
    val map2 = mutable.Map(("aaa"->11),("b"->29),("hello"->5))
    map1 ++= map2
    println(map1)
    println(map2)
  }
}
